// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false

/*全局注册axios*/
import axios from 'axios'
Vue.prototype.$axios = axios

/*全局注册jquery*/
// import jquery from 'jquery'
// Vue.prototype.$ = jquery

/*过滤器*/
import {imgFormat,tempFormat,sortImgFormat,distanceFormat,activitesFormat,tipsFormat,bgBlurFormat,scoreFormat,compareFormat} from './util/filters'
Vue.filter('imgFormat',imgFormat)
Vue.filter('tempFormat',tempFormat)
Vue.filter('sortImgFormat',sortImgFormat)
Vue.filter('distanceFormat',distanceFormat)
Vue.filter('activitesFormat',activitesFormat)
Vue.filter('tipsFormat',tipsFormat)
Vue.filter('bgBlurFormat',bgBlurFormat)
Vue.filter('scoreFormat',scoreFormat)
Vue.filter('compareFormat',compareFormat)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App}
})

function adaptWin(){
  var w = document.documentElement.clientWidth
  if(w > 760){
    w = 760
  }
  if(w < 300){
    w = 380
  }
  document.documentElement.style.fontSize = w / 38 + 'px'
}

/*窗口大小改变*/
adaptWin()
window.onresize = function(){
  adaptWin()
}